package com.sino.tb.auditing.entity;

import java.sql.*;
import java.util.*;

public class ConfirmDetailEntity {
	private String key;
	private String confirmKey;
	private String declareDetailKey;
	private String value;

	public static ConfirmDetailEntity[] findAll(String key, Connection conn) {
		ConfirmDetailEntity[] result = null;
		ArrayList middle = new ArrayList();
		StringBuffer sql = new StringBuffer("SELECT * ");
					 sql.append("FROM t_pub_acceptdetail ");
					 sql.append("WHERE c_accept_seq = ?  ORDER BY c_seq");

		try {
			PreparedStatement pstmt = conn.prepareStatement(sql.toString());
			pstmt.setString(1, key);
			ResultSet rs = pstmt.executeQuery();
			int i = 0;
			while (rs.next()) {
				ConfirmDetailEntity cde = new ConfirmDetailEntity();
				cde.setKey(rs.getString("c_seq"));
				cde.setConfirmKey(rs.getString("c_audit_seq"));
				cde.setDeclareDetailKey(rs.getString("c_declare_detail_seq"));
				cde.setValue(rs.getString("c_modify_value"));
				middle.add(i++, cde);
			}
			sql = null;
			rs.close();
			pstmt.close();
			ListIterator lit = middle.listIterator();
			result = new ConfirmDetailEntity[middle.size()];
			i = 0;
			while (lit.hasNext()) {
				result[i++] = (ConfirmDetailEntity) lit.next();
			}
			lit = null;
			middle = null;
		} catch (Exception e) {
			e.printStackTrace();
		}

		return result;

	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getConfirmKey() {
		return confirmKey;
	}

	public void setConfirmKey(String confirmKey) {
		this.confirmKey = confirmKey;
	}

	public String getDeclareDetailKey() {
		return declareDetailKey;
	}

	public void setDeclareDetailKey(String declareDetailKey) {
		this.declareDetailKey = declareDetailKey;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}
}
